import difflib.DiffUtils;
import difflib.Patch;

import java.util.ArrayList;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Arkanif
 */
public class TestResult {
	private RemoteAutotesterTest test;
	private ArrayList<String> studentOut;
	private Patch diff;
	private boolean same;
	
	public TestResult(RemoteAutotesterTest test, ArrayList<String> studentOut)	{
		this.test = test;
		this.studentOut = studentOut;
		this.diff = DiffUtils.diff(studentOut, test.getTestOutput());
		if (diff.getDeltas().isEmpty())
			same = true;
		else
			same = false;
	}

	@Override
	public String toString() {
		return "<" + test.toString() + ", " + studentOut + ", " + same + ">";
	}

	/**
	 * @return the test
	 */
	public RemoteAutotesterTest getTest() {
		return test;
	}

	/**
	 * @return the studentOut
	 */
	public ArrayList<String> getStudentOut() {
		return studentOut;
	}

	/**
	 * @return the diff
	 */
	public Patch getDiff() {
		return diff;
	}

	/**
	 * @return the same
	 */
	public boolean isSame() {
		return same;
	}
}
